package com.example.gerenciadorestudo;


import java.io.IOException;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.database.SQLException;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {
	public static SQliteHelper banco;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		 banco = new SQliteHelper(this);
	        
	        try {
	        	 
	        	banco.createDataBase();
	 
		 	} catch (IOException ioe) {
		 
		 		throw new Error("Unable to create database");
		 
		 	}
	        
			try {
	        	 
				MainActivity.banco.openDataBase();
		     
		     	}catch(SQLException sqle){
		     
		     		throw sqle;
		     
		     	}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}
	
	public void entrarMaterias(View v){
		Intent i = new Intent(this, Materias.class);
		startActivity(i);
	}

	public void entrarAvaliacoes(View v){
		Intent i = new Intent(this, Avaliacoes.class);
		startActivity(i);
	}
	
}
